<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>

<body>
<div class="layui-form timo-compile">
    <form th:action="@{/market/project/save}">
        <input type="hidden" name="id" th:if="${project}" th:value="${project.id}">
        <input type="hidden" name="numbering" th:if="${project}" th:value="${project.numbering}">
        <div class="layui-form-item">
            <label class="layui-form-label">项目名称</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="name" placeholder="请输入项目名称"
                       th:value="${project?.name}">
            </div>
            <label class="layui-form-label">项目阶段</label>
            <div class="layui-input-inline">
                <div class="layui-input-inline">
                    <select class="timo-search-select" name="stage" mo:dict="STAGE"
                            mo-selected="${project?.stage}" mo-empty=""
                            lay-verify="type"></select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">项目标签</label>
            <div class="layui-input-inline">
                <select class="timo-search-select" name="tag" mo:dict="CUSTTAG"
                        mo-selected="${project?.tag}" mo-empty=""
                        lay-verify="type"></select>
            </div>
            <label class="layui-form-label">客户名称</label>
            <div class="layui-input-inline">
                <select class="select" name="customerName" lay-search="">
                    <option value="">请选公司</option>
                    <span th:each="customer:${customers}">
                        <option th:text="${customer.name}"
                                th:selected="${project?.customerName} == ${customer.name}"
                                th:value="${customer.name}"></option>
                    </span>
                </select>
            </div>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input start-calendar" name="startDate"
                       th:value="${#dates.format(project?.startDate, 'yyyy-MM-dd')}">
            </div>
            <label class="layui-form-label">结束日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input end-calendar" name="endDate"
                       th:value="${#dates.format(project?.endDate, 'yyyy-MM-dd')}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责人</label>
            <div class="layui-input-inline">
                <select class="select" name="userName" lay-filter="userName" lay-search="">
                    <option value="">请选负责人</option>
                    <span th:each="user:${userList}">
                        <option th:text="${user.nickname}"
                                th:selected="${project?.userName} == ${user.nickname}"
                                th:value="${user.nickname}"></option>
                    </span>
                </select>
            </div>
            <label class="layui-form-label">协同人</label>
            <div style="width: 300px; display: inline-block; vertical-align: top;">
                <select name="partner" mo:list="${userMap}" xm-select="id" mo-selected="${partners}">
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea"
                          name="remark">[[${project?.remark}]]</textarea>
            </div>
        </div>
        <div class="layui-form-item timo-finally">
            <button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>
<script th:replace="/common/template :: script"></script>

</body>
</html>